//
//  StatisticsCell.m
//  PropertyMananger
//
//  Created by bh on 17/1/13.
//  Copyright © 2017年 BH. All rights reserved.
//

#import "StatisticsCell.h"

@implementation StatisticsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

+ (instancetype)cellWithTableView:(UITableView *)tableView
{

    static NSString * statisticCellID = @"statisticCellID";

    StatisticsCell * cell = [[StatisticsCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:statisticCellID];
    if (cell == nil) {
        
        cell = [tableView dequeueReusableCellWithIdentifier:statisticCellID];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;

}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
     
        self.orderCodeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.orderCodeLabel];
      //  self.orderCodeLabel.backgroundColor = BHRandColor;
        
        self.orderCodeLabel.text = @"订单编号：2017010100002";
        self.orderCodeLabel.textColor = BHColor(51, 51, 51);
        self.orderCodeLabel.font = BHFont(15);
        self.orderCodeLabel.textAlignment = NSTextAlignmentLeft;
        
        [self.orderCodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(15);
            make.top.equalTo(self).with.offset(12.5);
            make.height.mas_equalTo(25);
        }];
        
        self.timeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.timeLabel];
       // self.timeLabel.backgroundColor = BHRandColor;
        
        self.timeLabel.text = @"今天   09:00";
        self.timeLabel.textColor = BHColor(153, 153, 153);
        self.timeLabel.font = BHFont(13);
        self.timeLabel.textAlignment = NSTextAlignmentLeft;
        
       [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
           make.top.equalTo(self.orderCodeLabel.mas_bottom).with.offset(0);
           make.leading.equalTo(self.orderCodeLabel).with.offset(0);
           make.size.mas_equalTo(CGSizeMake(BHscreenW/2, 25));
       }];
        
        self.repairLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.repairLabel];
     //   self.repairLabel.backgroundColor = BHRandColor;
        
        self.repairLabel.text = @"公共报修";
        self.repairLabel.textColor = BHColor(51, 51, 51);
        self.repairLabel.font = BHFont(15);
        self.repairLabel.textAlignment = NSTextAlignmentRight;

        [self.repairLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.trailing.equalTo(self).with.offset(-15);
            make.centerY.equalTo(self).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(80, 25));
        }];
        
    }
    return self;
}
- (void)setModel:(ListDetail *)model{

    _model = model;
    if (model.Code == nil) {
        
        self.orderCodeLabel.text = [NSString stringWithFormat:@"订单编号:%@",@""];
    }else{
        
        self.orderCodeLabel.text = [NSString stringWithFormat:@"订单编号:%@",model.Code];
    }
    
    self.timeLabel.text = model.Time;
    self.repairLabel.text = model.Name;

}
@end
